import axios from '@/utils/myHttp';

enum Api {
  INTERVIEWQUESTIONS = '/api/interviewQ',
}

// Get personal center-basic settings
export const getInterviewQApi = (query?) => {
  if (query) {
    console.log('🚀 ~ getInterviewQCategoriesApi ~ query:', query);
    let str = '?';
    Object.keys(query).forEach((key) => {
      str += `${key}=${query[key]}`;
    });
    return axios.get<any>(`${Api.INTERVIEWQUESTIONS}${str}`);
  } else {
    return axios.get<any>(Api.INTERVIEWQUESTIONS);
  }
};

export const postInterviewQApi = (data) => axios.post(Api.INTERVIEWQUESTIONS, data);

export const putInterviewQApi = ({ id, ...data }) =>
  axios.put(`${Api.INTERVIEWQUESTIONS}/${id}`, data);

export const deleteInterviewQApi = ({ id }) => axios.delete(`${Api.INTERVIEWQUESTIONS}/${id}`);
